package justdoit.controller;

/**
 *
 * @author shadone
 */
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import justdoit.model.Task;

public class Reminder {

    Timer timer;

    public Reminder(int seconds) {
        timer = new Timer();
        timer.schedule(new RemindTask(), seconds * 1000);
    }

    class RemindTask extends TimerTask {

        public void run() {
            List<Task> taskList = new ArrayList<Task>();
            taskList = TaskManager.getCurrentUser().getTasks();
            for (Task task : taskList) {
                System.out.println("Time's up!");
            }
            timer.cancel();
        }
    }

    public static void main(String args[]) {
        System.out.println("About to schedule task.");
        new Reminder(5);
        System.out.println("Task scheduled.");
    }
}
